import React from 'react';
import Layout from '../../components/Layout';
import { RouteConfig } from './remaining';

// 懒加载 CRM 组件
const CRMDashboard = React.lazy(() => import('../../views/CRM'));
const CustomerManagement = React.lazy(() => import('../../views/CRM/Customer'));
const ContactManagement = React.lazy(() => import('../../views/CRM/Contact'));
const BusinessManagement = React.lazy(() => import('../../views/CRM/Business'));
const ContractManagement = React.lazy(() => import('../../views/CRM/Contract'));

const crmRoutes: RouteConfig[] = [
  {
    path: '/crm',
    element: <Layout />,
    children: [
      {
        path: '',
        element: <CRMDashboard />,
        meta: {
          title: 'CRM 概览',
          icon: 'team',
          noCache: false
        }
      },
      {
        path: 'customer',
        element: <CustomerManagement />,
        meta: {
          title: '客户管理',
          icon: 'user',
          noCache: false
        }
      },
      {
        path: 'contact',
        element: <ContactManagement />,
        meta: {
          title: '联系人管理',
          icon: 'contacts',
          noCache: false
        }
      },
      {
        path: 'business',
        element: <BusinessManagement />,
        meta: {
          title: '商机管理',
          icon: 'dollar',
          noCache: false
        }
      },
      {
        path: 'contract',
        element: <ContractManagement />,
        meta: {
          title: '合同管理',
          icon: 'file-text',
          noCache: false
        }
      }
    ],
    meta: {
      title: 'CRM 管理',
      icon: 'team'
    }
  }
];

export default crmRoutes;